package day13.KeJian;

import java.util.Properties;
import java.util.Set;

public class PropertiesDemo02 {
    public static void main(String[] args) {
        //创建集合对象
        Properties prop = new Properties();
        //Object setProperty(String key, String value)：设置集合的键和值，都是String类型
        prop.setProperty("heima001","张某某");
        prop.setProperty("heima002","王某某");
        prop.setProperty("heima003","李某某");

        //String getProperty(String key)：使用此属性列表中指定的键搜索属性
        System.out.println(prop.getProperty("heima002"));
        System.out.println(prop.getProperty("heima0023"));
        System.out.println(prop);
        //Set<String> stringPropertyNames()：从该属性列表中返回一个不可修改的键集，其中键及其对应的值是字符串
        Set<String> names = prop.stringPropertyNames();
        for (String key : names) {
            String value = prop.getProperty(key);
            System.out.println(key+","+value);
        }
    }
}
